﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Daughter : RelationBase
    {
        private static Daughter _singleton = new Daughter();
        public static Daughter Instance
        {
            get { return _singleton; }
        }

        private Daughter() { }
        
        public override bool IsRelated(Person a, Person b)
        {
            // b is a's Daughter IFF b is female AND (a is b's mother or father)
            return b.Sex == Sex.Female && (a == b.Mother || a == b.Father); // skip Child
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Mother.Instance, Father.Instance });
        }
    }
}
